#!/bin/sh
signature='python3 locator'
if [ "$1" == --version ]; then
   echo "$signature"
   exit 0
fi
tool=$(basename ${BASH_SOURCE[0]:-$0})
full="`which $tool 2>/dev/null`"
if [ -n "$full" ] && [ -x "$full" ] && [ "`"$full" --version 2>&1|head -n 1`" == "$signature" ]; then
   full=""
fi
if [ -z "$full" ]; then
   for f in `locate -ber "^$tool$"`; do
      if [ -x "$f" ] && [ $(basename "$f") == "$tool" ] && [ "`"$f" --version 2>&1|head -n 1`" != "$signature" ]; then
         full="$f"
         break
      fi
   done
   unset f
fi
if [ -z "$full" ]; then
   echo >&2;echo "Error: $tool can't be found, please, install one and update the following link:" >&2;echo >&2
   echo "      " ${BASH_SOURCE[0]:-$0} >&2;echo >&2
   exit 0
fi
unset signature tool
exec "$full" "$@"
